/*
 * Project: BoboDesignPattern
 * 
 * File Created at 2019年12月18日
 * 
 * Copyright 2012 Greenline.com Corporation Limited.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * Greenline Company. ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with Greenline.com.
 */
package test.practice;

/**
 * @Type A20191218_bridge_builder
 * @Desc
 * @author 52489
 * @date 2019年12月18日
 * @Version V1.0
 */
public class A20191218_bridge_builder {

    abstract class AbstractMessage {
        MessageImplementor messageImplementor;

        /**
         * @param messageImplementor
         */
        public AbstractMessage(MessageImplementor messageImplementor) {
            this.messageImplementor = messageImplementor;
        }

        public void sendMessage() {
            this.messageImplementor.send();
        }

    }

    class CommonMessage extends AbstractMessage {

        /**
         * @param messageImplementor
         */
        public CommonMessage(MessageImplementor messageImplementor) {
            super(messageImplementor);
        }

        /*
         * (non-Javadoc)
         * 
         * @see
         * test.practice.A20191218_bridge_builder.AbstractMessage#sendMessage()
         */
        @Override
        public void sendMessage() {
            System.out.println("普通消息");
            super.sendMessage();
        }

    }

    class UrgentMessage extends AbstractMessage {

        /**
         * @param messageImplementor
         */
        public UrgentMessage(MessageImplementor messageImplementor) {
            super(messageImplementor);
            // TODO Auto-generated constructor stub
        }

        /*
         * (non-Javadoc)
         * 
         * @see
         * test.practice.A20191218_bridge_builder.AbstractMessage#sendMessage()
         */
        @Override
        public void sendMessage() {
            super.sendMessage();
        }

        public Object watch(String messageId) {
            return null;
        }

    }

    interface MessageImplementor {
        void send();
    }

    class EmailMessage implements MessageImplementor {

        /*
         * (non-Javadoc)
         * 
         * @see test.practice.A20191218_bridge_builder.MessageImplementor#send()
         */
        @Override
        public void send() {
            System.out.println("发送email消息");
        }
    }

    class SMSMessage implements MessageImplementor {

        /*
         * (non-Javadoc)
         * 
         * @see test.practice.A20191218_bridge_builder.MessageImplementor#send()
         */
        @Override
        public void send() {
            System.out.println("发送短信消息");
        }

    }

    public static void main(String[] args) {
        AbstractMessage message = new A20191218_bridge_builder().new CommonMessage(
                new A20191218_bridge_builder().new SMSMessage());
        message.sendMessage();
    }
}
